<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>title</title>
    <link rel="shortcut icon"/>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
    </script>
</head>
<body>
<div >
    <h3>空气质量信息维护页面</h3>
    <form action="#"
          th:action="@{/update/updateQuality(qualityId=${qualityIndex.id})}"
          th:object="${qualityIndex}"
          method="post" onsubmit="return chekForm()">
        <label for="districtId">监测区域：</label>
        <select data-th-placeholder="qxz" id="districtId" name="districtId"
                th:value="${qualityIndex.id}" required>
            <option value="" selected>请选择</option>
            <option th:each="district:${districtList}"
                    th:value="${district.id}"
                    th:selected="${district.id == qualityIndex.districtId}"
                    th:text="${district.name}"></option>
        </select>
        <br />
        <input type="hidden" th:value="*{id}" name="id" />
        <ul>
            <li>监测日期:<input type="text"
                            name="monitorTime" id="monitorTime"
                            th:value="${#dates.format(qualityIndex.monitorTime,'yyyy-MM-dd HH:mm:ss')}" ></li>
            <li>PM10:<input type="text" id="pm10" name="pm10" th:value="${qualityIndex.pm10}"  required></li>
            <li>PM2.5:<input type="text" id="pm25" name="pm25" th:value="${qualityIndex.pm25}" required></li>
            <li>监测站:<input type="value" id="monitoringStation" name="monitoringStation"
                               th:value="${qualityIndex.monitoringStation}" required></li>
        </ul>

        <p>
            <input type="submit" value="更新"/>
            <input type='button' value='删除' onclick="delQuality()" />
            <input type="button" value="返回" onclick="javascript:history.back();" />
        </p>
    </form>
    <script th:inline="javascript">

        function delQuality(){
            var qualityId = [[${qualityIndex.id}]];
            if(confirm("确定删除记录吗？")){
                window.location.href = "/del/delete?qualityId="+qualityId;
            }

        }
    </script>
</div>
</body>
</html>